<?php
/**
 * Created by PhpStorm.
 * User: N
 * Date: 2018/03/11
 * Time: 15:17
 */
namespace common\models;

use Yii;
use yii\base\Model;
use common\models\Models;
use backend\modules\content\models\Sitemodel;
use backend\modules\content\models\Modelfield;
use yii\db\ActiveRecord;
use yii\data\ActiveDataProvider;
use yii\data\Pagination;
use common\models\User;


/**
 * 签到模型
 * This is the model class for table "Sign".
 *
 * @property string $catid
 * @property string $siteid
 **/
class Theme extends ActiveRecord
{
     /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%theme}}';
    }





    /**
    * 验证规则
    */
    public function rules()
    {
        return [
                    
            [['name'],'required','message'=>'不能为空'],
            [['info'],'string'],
            [['begin_time','end_time'],'default'],
            [['addtime'],'number'],   

                   
        ];
    }

    public function beforeSave($insert){
        if($insert){
           $this->addtime = time();
           $this->status = 0;
        }else{
          
        }
      
        return true;

    }


    public function afterSave(){
        // print_r($this);
        // exit;
    }


        /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'name' => '标题',
            'info' => '活动要求',
            'begin_time' => '开始时间',
            'end_time' => '结束时间',
        ];
    }

    


}